package com.itheima.d11_api_objects;

import java.util.Objects;

/*
    Objects是一个工具类，提供了很多操作对象的静态方法给我们使用。
        public static boolean equals(Object a, Object b)	先做非空判断，再比较两个对象
        public static boolean isNull(Object obj) 	判断对象是否为null，为null返回true ,反之
        public static boolean nonNull(Object obj) 	判断对象是否不为null，不为null则返回true, 反之
 */
public class Test {
    public static void main(String[] args) {
        Student s1 = new Student("小乔",12);
        s1= null;
        Student s2 = new Student("小乔",12);
        System.out.println(Objects.equals(s1,s2));

        System.out.println(Objects.isNull(s1));
        System.out.println(Objects.isNull(s2));

        System.out.println(Objects.nonNull(s1));
        System.out.println(Objects.nonNull(s2));
    }
}
